package com.example.demo.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * 功能描述：
 *
 * @Author: Zhanghf
 * @Date: 2021/12/11 11:59
 */
@Document(indexName = "knight2.0")
public class Book implements Serializable {

    @Id
    @TableId(type = IdType.AUTO)
    private Integer id;
    @Field(type = FieldType.Text)
    private String name;
    @Field(type = FieldType.Text)
    private String type;
    @Field(type = FieldType.Text)
    private String author;
    @Field(index = false)
    private String introduction;
    @Field(index = false)
    private Integer hits;
    @Field(index = false)
    private Integer collections;
    @Field(index = false)
    private Integer sourceid;
    @Field(index = false)
    private String url;
    @Field(index = false)
    private Integer latestnum;
    @Field(index = false)
    private String latesthref;
    @Field(index = false)
    private Date latestdate;
    @Field(index = false)
    private String latestchapter;
    @Field(index = false)
    private String state;
    @Field(index = false)
    private Integer pic;
    @Field(index = false)
    private Integer  wordnumber;

    public Book(String name, String type, String author, Integer hits, Integer collections, Integer sourceid, String url, String state, Integer wordnumber) {
        this.name = name;
        this.type = type;
        this.author = author;
        this.hits = hits;
        this.collections = collections;
        this.sourceid = sourceid;
        this.url = url;
        this.state = state;
        this.wordnumber = wordnumber;
    }

    public Integer getSourceid() {
        return sourceid;
    }

    public void setSourceid(Integer sourceid) {
        this.sourceid = sourceid;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Book)) return false;
        Book book = (Book) o;
        return Objects.equals(id, book.id) &&
                Objects.equals(name, book.name) &&
                Objects.equals(url, book.url);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, url);
    }

    public Book() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public Integer getHits() {
        return hits;
    }

    public void setHits(Integer hits) {
        this.hits = hits;
    }

    public Integer getCollections() {
        return collections;
    }

    public void setCollections(Integer collections) {
        this.collections = collections;
    }



    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getLatestnum() {
        return latestnum;
    }

    public void setLatestnum(Integer latestnum) {
        this.latestnum = latestnum;
    }

    public String getLatesthref() {
        return latesthref;
    }

    public void setLatesthref(String latesthref) {
        this.latesthref = latesthref;
    }

    public Date getLatestdate() {
        return latestdate;
    }

    public void setLatestdate(Date latestdate) {
        this.latestdate = latestdate;
    }

    public String getLatestchapter() {
        return latestchapter;
    }

    public void setLatestchapter(String latestchapter) {
        this.latestchapter = latestchapter;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Integer getPic() {
        return pic;
    }

    public void setPic(Integer pic) {
        this.pic = pic;
    }

    public Integer getWordnumber() {
        return wordnumber;
    }

    @Override
    public String toString() {
        return "Book{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", author='" + author + '\'' +
                ", introduction='" + introduction + '\'' +
                ", hits=" + hits +
                ", collections=" + collections +
                ", sourceid=" + sourceid +
                ", url='" + url + '\'' +
                ", latestnum=" + latestnum +
                ", latesthref='" + latesthref + '\'' +
                ", latestdate=" + latestdate +
                ", latestchapter='" + latestchapter + '\'' +
                ", state='" + state + '\'' +
                ", pic=" + pic +
                ", wordnumber=" + wordnumber +
                '}';
    }

    public void setWordnumber(Integer wordnumber) {
        this.wordnumber = wordnumber;
    }
}
